﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;  //  for Vector2
using Microsoft.Xna.Framework.Graphics;   //   for Texture2D

namespace zombieArena
{
    class Spread : Weapon
    {
        Random r = new Random();
        Matrix rotation1 = Matrix.CreateRotationZ(MathHelper.ToRadians(25));
        Matrix rotation2 = Matrix.CreateRotationZ(MathHelper.ToRadians(-25));
        
        public Spread(Texture2D t)
            : base(t)
        {
            ammo = 35;
            rateOfFire = 200f;
            bulletSpeed = 15f;
            name = "Spreader";
            soundIndex = 4;
        }

        public override void shoot(Vector2 position, Vector2 direction, Map map)
        {
            map.bulletList.Add(new Bullet(position, direction * bulletSpeed, texture));

            map.bulletList.Add(new Bullet(position, Vector2.Transform(direction, rotation1) * bulletSpeed, texture));

            map.bulletList.Add(new Bullet(position, Vector2.Transform(direction, rotation2) * bulletSpeed, texture));

            ammo--;
        }
    }
}
